<HTML><HEAD><TITLE>set_suspension_data(+Susp, +Name, +Value)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Advanced Control and Suspensions</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>set_suspension_data(+Susp, +Name, +Value)</H1>
Modify properties of suspended goals.


<DL>
<DT><EM>Susp</EM></DT>
<DD>A suspension or variable.
</DD>
<DT><EM>Name</EM></DT>
<DD>An atom.
</DD>
<DT><EM>Value</EM></DT>
<DD>An integer.
</DD>
</DL>
<H2>Description</H2>
   This built-in is used to modify fields of the abstract suspension
   data type.  The modifiable properties of a suspension are:

<P>
<PRE>
Name        Type        Value
-------------------------------------------------------------
priority    Integer     Waking priority
invoc       Integer     Invocation number (debugging)
</PRE>
   All modifications are undone on backtracking. Changes to the priority
   only have an effect the next time the suspension is scheduled
   (ie changing the priority of an already scheduled suspension has
   no effect unless it is a demon which can become suspended again).
   If Susp is a variable or a dead suspension, this predicate
   silently succeeds, doing nothing.

<P>
   Note that a suspension is not a standard logical data structure and can
   only be manipulated in a restricted way.  In particular, a suspension
   cannot be printed (e.g. using writeq/1,2) and then read back, giving a
   term identical to the one that was printed.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>set_suspension_data(+, +, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Name or Value is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Susp is instantiated, but not a suspension.
<DT><EM>(5) type error </EM>
<DD>Name is instantiated but not an atom.
<DT><EM>(6) out of range </EM>
<DD>Name is not the name of a modifiable suspension property.
</DL>
<H2>Examples</H2>
<PRE>
    [eclipse 1]: make_suspension(writeln(hello),5,S),
	    set_suspension_data(S, priority, 2),
	    get_suspension_data(S, priority, P).

    S = 'SUSP-_123-susp'
    P = 2
    Delayed goals:
	    writeln(hello)
    yes.


    :- demon d/2.
    d(X, Susp) :-
        ( var(S) -&gt;        % initial suspend
	    suspend(d(X, Susp), 5, X-&gt;constrained, Susp)
	; finished(X) -&gt;   % terminate
	    kill_suspension(Susp)
	; useful(X) -&gt;     % raise priority
	    set_suspension_data(Susp, priority, 4)
	;                  % lower priority
	    set_suspension_data(Susp, priority, 6)
	).




</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/suspensions/delayed_goals-1.html">delayed_goals / 1</A>, <A HREF="../../kernel/suspensions/kill_suspension-1.html">kill_suspension / 1</A>, <A HREF="../../kernel/suspensions/make_suspension-3.html">make_suspension / 3</A>, <A HREF="../../kernel/suspensions/get_suspension_data-3.html">get_suspension_data / 3</A>, <A HREF="../../kernel/suspensions/get_priority-1.html">get_priority / 1</A>, <A HREF="../../kernel/suspensions/call_priority-2.html">call_priority / 2</A>, <A HREF="../../kernel/suspensions/suspend-3.html">suspend / 3</A>, <A HREF="../../kernel/suspensions/suspensions-1.html">suspensions / 1</A>, <A HREF="../../kernel/suspensions/current_suspension-1.html">current_suspension / 1</A>, <A HREF="../../kernel/suspensions/get_suspension_data-3.html">get_suspension_data / 3</A>
</BODY></HTML>
